import java.io.File;
import javax.swing.JOptionPane;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;

public class ImportRemind {
	static String noteTitle, content, reminderTime;
	static int ways;
	static String mail, id;

    public static void main(String[] args) throws Exception{
        //1:����workbook
        Workbook workbook=Workbook.getWorkbook(new File("importData.xls")); 
        //2:��ȡ��һ��������sheet
        Sheet sheet=workbook.getSheet(0);
        //3:��ȡ����
        System.out.println("�У�"+sheet.getRows());
        System.out.println("�У�"+sheet.getColumns());
        id = LoginInterface.onlineID;
        for(int i=1;i<sheet.getRows();i++){
            for(int j=0;j<sheet.getColumns();j++){
                Cell cell=sheet.getCell(j,i);
                if(j ==0) {
                	noteTitle = cell.getContents()+"";
                }else if(j == 1) {
                	content = cell.getContents()+"";
                }else if(j == 2) {
                	reminderTime = cell.getContents()+"";
                }else if(j == 3) {
                	ways = Integer.parseInt(cell.getContents()+"");
                }else if(j == 4) {
                	mail = cell.getContents()+"";
                	DatabaseCtrl.init();
                	DatabaseCtrl.insertRemindData(noteTitle, content, reminderTime, ways, mail, id);
                	System.out.println(noteTitle+"����ɹ�");
                }         
                System.out.print(cell.getContents()+" ");
            }
            System.out.println();
        }
        DatabaseCtrl.close();
        
        //���һ�����ر���Դ
        workbook.close();
        JOptionPane.showMessageDialog(null, "����ɹ�", "��ʾ!", JOptionPane.INFORMATION_MESSAGE);
        System.out.println("����ɹ���");
    }

}